package com.ss.android.article.common;

import android.app.Activity;
import android.content.Context;
import android.text.TextUtils;

import com.bytedance.common.utility.UIUtils;
import com.ss.android.article.browser.R;
import com.ss.android.article.common.http.ApiError;

public final class gg {
    private final Context a;
    private final String b;

    public gg(Context arg2, int arg3) {
        this(arg2, arg2.getString(arg3));
    }

    private gg(Context arg1, String arg2) {
        this.a = arg1;
        this.b = arg2;
    }

    public final void a(Throwable arg4) {
        int v2 = R.drawable.close_popup_textpage;
        if (this.a != null && (!(this.a instanceof Activity) || !((Activity) this.a).isFinishing())) {
            if ((arg4 instanceof ApiError)) {
                String v0 = ((ApiError) arg4).mErrorTips;
                if (!TextUtils.isEmpty(((CharSequence) v0))) {
                    UIUtils.showImageToast(this.a, v2, v0);
                    return;
                }
            }

            UIUtils.showImageToast(this.a, v2, this.b);
        }
    }
}

